<?php
class AdModel extends Action{
	//test
	//
	//############test
	public function getorderplus(){
		$info=collectinfo(__METHOD__,'',array());
		
		$ad=M('ad');
		$ado=$ad->order('adorder DESC')->find();

		if($ado){
			$order=$ado['adorder']+1;
		}else{
			$order=1;
		}
		return createarrok('ok',$order,'',$info);
	}


	public function generatedaima(){
		$info=collectinfo(__METHOD__,'',array());
		
		$ad=M('ad');
		$adls=$ad->order('adorder ASC')->select();

		if($adls){

			$strall="<div class='hdc cl'>";

			foreach($adls as $adv){
				$str="<div style='width:".$adv['adwidth']."%;height:".$adv['adheight']."px;position:relative;float:left;'><a href='".$adv['adhref']."' target='_blank'><img src='".$adv['adsrc']."'  style='width:100%;height:".$adv['adheight']."px;overflow:hidden'></a></div>";
				$strall=$strall.$str;
			}

			$strall=$strall."</div>";
		}else{
			$strall='';
		}

		return createarrok('ok',$strall,'',$info);
	}

} 
?>